﻿<%@ Page Language="c#" CodeBehind="Default.aspx.cs" AutoEventWireup="false" Inherits="UDS.SubModule.WorkAttendance.DefaultPage" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
  <title>Default</title>
  <uds:Style runat="server" Href="~/Css/BasicLayout.css" />
  <script type="text/javascript">
  //<!--
  // update local time
  var startTime_server = <%= Utility.GetJSDateValue(DateTime.Now) %>;
  var startTime_local = new Date().valueOf();
  function Timer()
  {
    var to_2_digits = function(v)
    {
      return v<10 ? ('0'+v) : v.toString();
    };
    
    var now_local = new Date().valueOf();
    var now_server = new Date(startTime_server + (now_local - startTime_local));
    
    var s = "";
    s += to_2_digits(now_server.getUTCHours()) + ":";
    s += to_2_digits(now_server.getUTCMinutes()) + ":";
    s += to_2_digits(now_server.getUTCSeconds());
    
    document.getElementById("<%= lbl_CurrentTime.ClientID %>").innerHTML = s;
  }

  function GetServerTime(updatespan)
  {	
    // update the display time
	  setInterval("Timer();", 1000);

	  // sync the time with the server.
	  setInterval("window.location.href = 'ControlHeader.aspx';", updatespan);
  }
  
  function off_duty()
  {
    var r = window.confirm("您要现在下班吗？");
    return r === true;
  }
  //-->
  </script>
</head>
<body onload="GetServerTime(15*60*1000);">
  <form method="post" runat="server">
    <uds:PageTitle runat="server" HintImage="~/DataImages/page2.gif" Title="我的考勤" />
    <table style="height: 258px" cellspacing="1" cellpadding="1" width="100%" border="0" class="gbtext">
      <tr>
        <td align="center" height="50"><asp:Label ID="lblDutyMessage" runat="server">考勤信息</asp:Label> <asp:Label runat="server" ID="lbl_CurrentTime" /> </td>
      </tr>
      <tr>
        <td align="center">
          <asp:TextBox ID="txtAttendanceMemo" runat="server" TextMode="MultiLine" Height="150px" Width="500px" Visible="False" />
        </td>
      </tr>
      <tr>
        <td align="center" height="40">
          <asp:Button ID="btnCheckAttendance" CommandArgument="" runat="server" CssClass="buttoncss" Width="80px" />
        </td>
      </tr>
      <tr>
        <td>
          <asp:DataGrid ID="grdWeekAttendanceData" runat="server" Width="100%" AutoGenerateColumns="False" CellPadding="3" BorderWidth="1px" CssClass="gbtext" BorderColor="#93BEE2" PageSize="5" AllowPaging="True">
            <HeaderStyle ForeColor="Black" BackColor="#E8F4FF" />
            <Columns>
              <asp:TemplateColumn HeaderText="日期">
                <ItemTemplate>
                  <%# DateTime.Parse(((DataRowView)Container.DataItem)["WorkDate"].ToString()).ToShortDateString()%>
                </ItemTemplate>
              </asp:TemplateColumn>
              <asp:TemplateColumn HeaderText="上班时间">
                <ItemTemplate>
                  <%# GetTime(((DataRowView)Container.DataItem)["OnDuty"])%>
                </ItemTemplate>
              </asp:TemplateColumn>
              <asp:TemplateColumn HeaderText="上班备注">
                <ItemTemplate>
                  <%# GetMemo(((DataRowView)Container.DataItem)["OnDuty_MemoID"])%>
                </ItemTemplate>
              </asp:TemplateColumn>
              <asp:TemplateColumn HeaderText="下班时间">
                <ItemTemplate>
                  <%#	GetTime(((DataRowView)Container.DataItem)["OffDuty"])%> <asp:Literal ID="Literal2" runat="server"></asp:Literal>
                </ItemTemplate>
              </asp:TemplateColumn>
              <asp:TemplateColumn HeaderText="下班备注">
                <ItemTemplate>
                  <%# GetMemo(((DataRowView)Container.DataItem)["OffDuty_MemoID"])%>
                </ItemTemplate>
              </asp:TemplateColumn>
            </Columns>
            <PagerStyle NextPageText="下周考勤记录" PrevPageText="上周考勤记录" HorizontalAlign="Center" />
          </asp:DataGrid>
        </td>
      </tr>
    </table>
  </form>
</body>
</html>
